package com.example.ssu_eduapp.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.example.ssu_eduapp.eventlistener.SsuEduappListenerManager;
import com.example.ssu_eduapp.tools.Constants;
import com.example.ssu_eduapp.tools.LogUtils;

public class EventReceiver extends BroadcastReceiver{
	
	private static String TAG = EventReceiver.class.getSimpleName();
	private static LogUtils log = new LogUtils(TAG);
	
	@Override
	public void onReceive(Context context, Intent intent) {
		
		String action = intent.getAction().trim();
		log.i("action : "+ action);
		
		if(action.equals(Constants.INTENT_FILTER_ACTION_CONNECTION_CLOSED))
		{
			log.i("INTENT_FILTER_ACTION_CONNECTION_CLOSED");
			SsuEduappListenerManager.connectionClosed();
		}
		
		if(action.equals(Constants.INTENT_FILTER_ACTION_LOGGED_IN)){
			log.i("INTENT_FILTER_ACTION_LOGGED_IN");
			SsuEduappListenerManager.connectionLoggedIn();
		}
		
		if(action.equals(Constants.INTENT_FILTER_ACTION_PROGRESS_DIALOG))
		{
			log.i("INTENT_FILTER_ACTION_PROGRESS_DIALOG");
			SsuEduappListenerManager.progressDialgReceiver(intent.getBooleanExtra("login", false));
		}
		
		
		
	}

}
